package com.explorati.LeetCode010.fib;


import java.util.Arrays;

/**
 * @ Author : Weijian_Wang
 * @ Date : Created in 21:03 2020/10/5 0005
 * @ Description ：
 */
public class Solution {

    public int fib(int n) {
        int a = 0, b = 1, sum;
        for(int i = 0; i < n; i++){
            //取模操作，防止整数溢出
            sum = (a + b) % 1000000007;
            a = b;
            b = sum;
        }
        return a;
    }
}
